Python Programming for Beginners Crash Course with Hands-On Exercises, Including NumPy, Pandas and Matplotlib by Ibnul Jaif Farabi

Python Programming for Beginners Crash Course with Hands-On Exercises, Including NumPy, Pandas and Matplotlib by Ibnul Jaif Farabi

Author:Ibnul Jaif Farabi
Language: eng
Format: epub
Tags: Python Programming, Programming, Computer Science, Computer Programming, Software Development, Introductory & Beginning Programming
Publisher: Ibnul Jaif Farabi
Published: 2022-12-07T05:00:00+00:00


We can also add, subtract, multiply and divide the elements in an array at the same time in the following way.

Code:

list_02 = [[26, 87, 24, 56], [15, 67, 45, 98], [65, 34, 96, 16]]

array_02 = np.array(list_02)

print("array_02:
", array_02) #array_02

print("Adding 5 to all the elements:
", (array_02 + 5)) #Adding 5 to each element

print("Subtracting 7 from all the elements:
", (array_02 - 7)) #Subtracting 7 from each element

print("Multiplying all the elements by 4:
", (array_02 * 4)) #Multiplying each element by 4

print("Dividing all the elements by 8:
", (array_02 / 8)) #Dividing each element by 8



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.